<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>CIA微博</title>

    
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/font-awesome.min.css" rel="stylesheet">
	<link href="css/index.css" rel="stylesheet">
    <link href="stickup.css" rel="stylesheet">   
    <link href="__PUBLIC__/css/iosOverlay.css"  rel="stylesheet" type="text/css">
	<script src="js/jquery.js"></script>	
	<script src="js/jquery.snippet.min.js"></script>
	<script src="js/bootstrap.min.js"></script>	
	<script src="js/holder.js"></script>	
	<script src="js/jquery.pin.min.js"></script>	
	<script src="js/stickUp.min.js"></script>	
	<script src="js/bootstrap-wysiwyg.js"></script>	
	<script src="js/jquery.hotkeys.js"></script>	
    <script src="__PUBLIC__/js/iosOverlay.js"></script>
    <script src="__PUBLIC__/js/spin.min.js"></script>
	
	<!--<style>
	 *{border: 1px solid rgb(250,0,255);}
	</style>-->
  </head>
  <body>
<div class="btn-toolbar" data-role="editor-toolbar" data-target="#editor" style="margin:20px;">

      <div class="btn-group">
        <a class="btn tag-1" data-edit="bold" title="Bold (Ctrl/Cmd+B)"><i class="icon-bold"></i></a>

        <a class="btn" data-edit="strikethrough" title="Strikethrough"><i class="icon-strikethrough"></i></a>
        <a class="btn" data-edit="underline" title="Underline (Ctrl/Cmd+U)"><i class="icon-underline"></i></a>
      </div>
      <div class="btn-group">
        <a class="btn" data-edit="insertunorderedlist" title="Bullet list"><i class="icon-list-ul"></i></a>
        <a class="btn" data-edit="insertorderedlist" title="Number list"><i class="icon-list-ol"></i></a>
        
      </div>

      <div class="btn-group">
		  <a class="btn dropdown-toggle" data-toggle="dropdown" title="Hyperlink"><i class="icon-link"></i></a>
		    <div class="dropdown-menu input-append">
			    <input class="span2" placeholder="URL" type="text" data-edit="createLink"/>
			    <button class="btn" type="button">Add</button>
        </div>
        <a class="btn" data-edit="unlink" title="Remove Hyperlink"><i class="icon-cut"></i></a>

      </div>
      
      <div class="btn-group">
        <a class="btn" title="Insert picture (or just drag & drop)" id="pictureBtn"><i class="icon-picture"></i></a>
        <input type="file" data-role="magic-overlay" data-target="#pictureBtn" data-edit="insertImage" />
      </div>
      <div class="btn-group">
        <a class="btn" data-edit="undo" title="Undo (Ctrl/Cmd+Z)" placement="bottom"><i class="icon-undo"></i></a>
        <a class="btn" data-edit="redo" title="Redo (Ctrl/Cmd+Y)" placement="bottom"><i class="icon-repeat"></i></a>
      </div>

    </div>

    <div id="editor">
      Go ahead&hellip;
    </div>
	<div class="bs-example" style="padding-bottom: 24px;">
      <button type="button" id="fat-btn" data-loading-text="正在加载..." class="btn btn-primary">
        Loading state
      </button>
    </div>
  </body>
 <script>
  $(function(){
    function initToolbarBootstrapBindings() {

      $('a[title]').tooltip({container:'body',placement:'bottom'});
    	$('.dropdown-menu input').click(function() {return false;})
		    .change(function () {$(this).parent('.dropdown-menu').siblings('.dropdown-toggle').dropdown('toggle');})
        .keydown('esc', function () {this.value='';$(this).change();});

      $('[data-role=magic-overlay]').each(function () { 
        var overlay = $(this), target = $(overlay.data('target')); 
        overlay.css('opacity', 0).css('position', 'absolute').offset(target.offset()).width(target.outerWidth()).height(target.outerHeight());
      });
      if ("onwebkitspeechchange"  in document.createElement("input")) {
        var editorOffset = $('#editor').offset();
        $('#voiceBtn').css('position','absolute').offset({top: editorOffset.top, left: editorOffset.left+$('#editor').innerWidth()-35});
      } else {
        $('#voiceBtn').hide();
      }
	};
	function showErrorAlert (reason, detail) {
		var msg='';
		if (reason==='unsupported-file-type') { msg = "Unsupported format " +detail; }
		else {
			console.log("error uploading file", reason, detail);
		}
		$('<div class="alert"> <button type="button" class="close" data-dismiss="alert">&times;</button>'+ 
		 '<strong>File upload error</strong> '+msg+' </div>').prependTo('#alerts');
	};
    initToolbarBootstrapBindings();  
	$('#editor').wysiwyg({ fileUploadError: showErrorAlert} );
    window.prettyPrint && prettyPrint();

  });
</script>
 <script>
$(document).ready(function(){
/*
 * 初始化按钮的loading功能，点击后将显示Loading字样，并且按钮被disabled掉，无法连续点击，防止二次提交
 * 超过3秒后按钮将恢复原状
 */
$('button[data-loading-text]').click(function () {
    var btn = $(this).button('loading');
    setTimeout(function () {
        btn.button('reset');
    }, 3000);
});
  $("#editor").ajaxSend(function(e,xhr,opt){
    $(this).html("正在请求：" + opt.url);
  });
  $("#fat-btn").click(function(){
	alert();
    $("#editor").load("123.html");
  });
});
 </script>
</html>
